<table id="users" class="datatable table table-striped table-bordered" >
  <caption><h3><%= @page_title %></h3></caption>
  <thead>
    <tr>
      <th>First Name</th>
      <th>Last Name</th>
      <th>Username</th>
      <th>Roles</th>
      <th>Last Sign-In</th>
      <th>Current Sign-In</th>
      <th>Sign-in Count</th>
      <th></th>
    </tr>
  </thead>
  <tbody>
    <% @users.each do |user| %>
      <tr>
        <td><%= user.firstname %></td>
        <td><%= link_to user.lastname, user if user.lastname %></td>
        <td><%= link_to user.username, user %></td>
        <td><%= user.roles.pluck(:name).to_sentence %></td>
        <td><%= user.last_sign_in_at.to_s(:short) if user.last_sign_in_at %></td>
        <td><%= user.current_sign_in_at.to_s(:short) if user.current_sign_in_at %></td>
        <td><%= user.sign_in_count if user.sign_in_count %></td>
        <td><%= table_button_link 'Edit', edit_user_path(user) if can? :update, user %></td>
      </tr>
    <% end %>
  </tbody>
</table>
